package com.biz.primus.model.member.vo.request;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

/**
 * 可以分页的请求vo
 *
 * @author jun.liu
 * @date 2017年10月22日
 * @reviewer
 * @see
 */
@ApiModel(description = "vo")
@Getter
@Setter
@ToString
public class BasePageableRequestVo extends BaseRequestVo
{

	public BasePageableRequestVo()
	{

	}

	public BasePageableRequestVo(Integer page, Integer size)
	{
		this.page = page;
		this.size = size;
	}


	@ApiModelProperty("默认为0即第一页")
	private Integer page = 0;

	// 不提供从手机提交的请求数据反序列化出size的途径,但是应该可以在后台手动修改
	@JsonIgnore
	@ApiModelProperty("默认为每页10条")
	private Integer size = 10;

	public Pageable toPageable() {
		return new PageRequest(page, size);
	}
}
